package menuService

import (
	"fmt"
	menuDto "news_for_deepseek_interface/dto/admin/system/menu"
	"news_for_deepseek_interface/model"
	adminModel "news_for_deepseek_interface/model/admin"
)

// 删除菜单
func DeleteMenu(params menuDto.DeleteMenuRequest) (err error) {

	if err = model.
		GetInstance().
		GetDB().
		Model(&adminModel.AdminAuthRuleStruct{}).
		Where("id IN (?)", params.Id).
		Delete(&adminModel.AdminAuthRuleStruct{}).Error; err != nil {
		err = fmt.Errorf("删除菜单失败: %v", err)
		return
	}

	return nil
}
